package com.zhao.modleclass.activity;

import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.Window;

import com.zhao.modleclass.R;
import com.zhao.modleclass.myview.TakePhotoPopWin;
import com.zhao.modleclass.myview.TakePhotoPopWinHeight;

/**
 * Created by 张博文 on 2016/12/16.
 */

public class SettingPerson extends AppCompatActivity {
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.setting_person);
        //设置状态栏的颜色
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            Window window = getWindow();
            //获取样式中的属性值
            TypedValue typedValue = new TypedValue();
            this.getTheme().resolveAttribute(Color.parseColor("#FF4081"), typedValue, true);
            int[] attribute = new int[]{Color.parseColor("#FF4081")};
            TypedArray array = this.obtainStyledAttributes(typedValue.resourceId, attribute);
            int color = array.getColor(0, Color.parseColor("#FF4081"));
            array.recycle();
            window.setStatusBarColor(color);
        }
    }

        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.iv_setting_back:
                    finish();
                    break;
                case R.id.sp_weight:

                    break;
                case R.id.sp_sex:
                    TakePhotoPopWin takePhotoPopWin_sex = new TakePhotoPopWin(this);
                    takePhotoPopWin_sex.showAtLocation(findViewById(R.id.setPerson_view), Gravity.CENTER, 0, 0);
                    break;
                case R.id.sp_height:
                    TakePhotoPopWinHeight takePhotoPopWin_height = new TakePhotoPopWinHeight(this);
                    takePhotoPopWin_height.showAtLocation(findViewById(R.id.setPerson_view), Gravity.CENTER, 0, 0);
                    break;
            }
        }
}
